<?php
$flagview = isset($_SESSION['newpage']) ? intval($_SESSION['newpage']) : 0;
if ($flagview > 0) {
   $viewss = file("counterlog.txt");
   $views = $viewss[0];
}
else
{
    $viewss = file("counterlog.txt");
    $views = $viewss[0];
    $views++;
    $fp = fopen("counterlog.txt", "w");
    fwrite($fp, $views);
    fclose($fp);
    $_SESSION['newpage'] = 1;
}
?>